home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Finder.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  15.0 KB  |  424 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Finder.h
  3.  
  4.      Contains:    Finder flags and container types.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __FINDER__
  18. #define __FINDER__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __QUICKDRAW__
  24. #include <Quickdraw.h>
  25. #endif
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. /* Creator and type of clipping files */
  53.  
  54. enum {
  55.     kClippingCreator            = FOUR_CHAR_CODE('drag'),
  56.     kClippingPictureType        = FOUR_CHAR_CODE('clpp'),
  57.     kClippingTextType            = FOUR_CHAR_CODE('clpt'),
  58.     kClippingSoundType            = FOUR_CHAR_CODE('clps'),
  59.     kClippingUnknownType        = FOUR_CHAR_CODE('clpu')
  60. };
  61.  
  62.  
  63. /* Creator and type of Internet Location files */
  64.  
  65. enum {
  66.     kInternetLocationCreator    = FOUR_CHAR_CODE('drag'),
  67.     kInternetLocationHTTP        = FOUR_CHAR_CODE('ilht'),
  68.     kInternetLocationFTP        = FOUR_CHAR_CODE('ilft'),
  69.     kInternetLocationFile        = FOUR_CHAR_CODE('ilfi'),
  70.     kInternetLocationMail        = FOUR_CHAR_CODE('ilma'),
  71.     kInternetLocationNNTP        = FOUR_CHAR_CODE('ilnw'),
  72.     kInternetLocationAFP        = FOUR_CHAR_CODE('ilaf'),
  73.     kInternetLocationAppleTalk    = FOUR_CHAR_CODE('ilat'),
  74.     kInternetLocationGeneric    = FOUR_CHAR_CODE('ilge')
  75. };
  76.  
  77.  
  78.  
  79.  
  80. enum {
  81.     kCustomIconResource            = -16455                        /* Custom icon family resource ID */
  82. };
  83.  
  84. /* In order to specify any of the information described in the */
  85. /* CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid */
  86. /* and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field, */
  87. /* and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to */
  88. /* the file or to the "Icon/n" file for a folder */
  89.  
  90. enum {
  91.     kCustomBadgeResourceType    = FOUR_CHAR_CODE('badg'),
  92.     kCustomBadgeResourceID        = kCustomIconResource,
  93.     kCustomBadgeResourceVersion    = 0
  94. };
  95.  
  96.  
  97. struct CustomBadgeResource {
  98.     SInt16                             version;                    /* This is version kCustomBadgeResourceVersion*/
  99.     SInt16                             customBadgeResourceID;        /* If not 0, the ID of a resource to use on top*/
  100.                                                                 /* of the icon for this file or folder*/
  101.     OSType                             customBadgeType;            /* If not 0, the type and creator of an icon*/
  102.     OSType                             customBadgeCreator;            /* to use on top of the icon*/
  103.     OSType                             windowBadgeType;            /* If not 0, the type and creator of an icon*/
  104.     OSType                             windowBadgeCreator;            /* to display in the header of the window for this */
  105.                                                                 /* file or folder*/
  106.     OSType                             overrideType;                /* If not 0, the type and creator of an icon to*/
  107.     OSType                             overrideCreator;            /* use INSTEAD of the icon for this file or folder*/
  108. };
  109. typedef struct CustomBadgeResource        CustomBadgeResource;
  110. typedef CustomBadgeResource *            CustomBadgeResourcePtr;
  111. typedef CustomBadgeResourcePtr *        CustomBadgeResourceHandle;
  112. /* You can specify routing information for a file by including a 'rout' 0 
  113.     resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended 
  114.     Finder flags. 
  115.     The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
  116.     in turn. The first matching entry is used.
  117.     If the creator and fileType match the file being dropped and targetFolder match
  118.     the folder ID of the folder being dropped onto, then the file is rerouted 
  119.     into the specified destination folder.
  120.     The only target folder currently supported is the system folder, 
  121.     kSystemFolderType = 'macs'.
  122. */
  123.  
  124. enum {
  125.     kRoutingResourceType        = FOUR_CHAR_CODE('rout'),
  126.     kRoutingResourceID            = 0
  127. };
  128.  
  129.  
  130. struct RoutingResourceEntry {
  131.     OSType                             creator;                    /* Use '****' or 0 to match any creator */
  132.     OSType                             fileType;                    /* Use '****' or 0 to match any file type */
  133.     OSType                             targetFolder;                /* Folder ID of the folder this file was dropped onto */
  134.     OSType                             destinationFolder;            /* Folder that the source will be routed to */
  135.     OSType                             reserved;                    /* Set to 0 */
  136. };
  137. typedef struct RoutingResourceEntry        RoutingResourceEntry;
  138.  
  139. typedef RoutingResourceEntry *            RoutingResourcePtr;
  140. typedef RoutingResourcePtr *            RoutingResourceHandle;
  141.  
  142. /* Types for special container aliases */
  143.  
  144. enum {
  145.     kContainerFolderAliasType    = FOUR_CHAR_CODE('fdrp'),        /* type for folder aliases */
  146.     kContainerTrashAliasType    = FOUR_CHAR_CODE('trsh'),        /* type for trash folder aliases */
  147.     kContainerHardDiskAliasType    = FOUR_CHAR_CODE('hdsk'),        /* type for hard disk aliases */
  148.     kContainerFloppyAliasType    = FOUR_CHAR_CODE('flpy'),        /* type for floppy aliases */
  149.     kContainerServerAliasType    = FOUR_CHAR_CODE('srvr'),        /* type for server aliases */
  150.     kApplicationAliasType        = FOUR_CHAR_CODE('adrp'),        /* type for application aliases */
  151.     kContainerAliasType            = FOUR_CHAR_CODE('drop'),        /* type for all other containers */
  152.     kDesktopPrinterAliasType    = FOUR_CHAR_CODE('dtpa'),        /* type for Desktop Printer alias */
  153.     kContainerCDROMAliasType    = FOUR_CHAR_CODE('cddr')        /* type for CD-ROM alias */
  154. };
  155.  
  156. /* Types for Special folder aliases */
  157.  
  158. enum {
  159.     kSystemFolderAliasType        = FOUR_CHAR_CODE('fasy'),
  160.     kAppleMenuFolderAliasType    = FOUR_CHAR_CODE('faam'),
  161.     kStartupFolderAliasType        = FOUR_CHAR_CODE('fast'),
  162.     kPrintMonitorDocsFolderAliasType = FOUR_CHAR_CODE('fapn'),
  163.     kPreferencesFolderAliasType    = FOUR_CHAR_CODE('fapf'),
  164.     kControlPanelFolderAliasType = FOUR_CHAR_CODE('fact'),
  165.     kExtensionFolderAliasType    = FOUR_CHAR_CODE('faex')
  166. };
  167.  
  168. /* Types for AppleShare folder aliases */
  169.  
  170. enum {
  171.     kExportedFolderAliasType    = FOUR_CHAR_CODE('faet'),
  172.     kDropFolderAliasType        = FOUR_CHAR_CODE('fadr'),
  173.     kSharedFolderAliasType        = FOUR_CHAR_CODE('fash'),
  174.     kMountedFolderAliasType        = FOUR_CHAR_CODE('famn')
  175. };
  176.  
  177. /* Finder flags (finderFlags, fdFlags and frFlags) */
  178. /* Any flag reserved or not specified should be set to 0. */
  179. /* If a flag applies to a file, but not to a folder, make sure to check */
  180. /* that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) */
  181.  
  182. enum {
  183.     kIsOnDesk                    = 0x0001,                        /* Files and folders */
  184.     kColor                        = 0x000E,                        /* Files and folders */
  185.                                                                 /* bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use*/
  186.     kIsShared                    = 0x0040,                        /* Files only (Applications only) */
  187.                                                                 /* If clear, the application needs to write to */
  188.                                                                 /* its resource fork, and therefore cannot be */
  189.                                                                 /* shared on a server */
  190.     kHasNoINITs                    = 0x0080,                        /* Files only (Extensions/Control Panels only) */
  191.                                                                 /* This file contains no INIT resource */
  192.     kHasBeenInited                = 0x0100,                        /* Files only */
  193.                                                                 /* Clear if the file contains desktop database */
  194.                                                                 /* resources ('BNDL', 'FREF', 'open', 'kind'...) */
  195.                                                                 /* that have not been added yet. Set only by the Finder */
  196.                                                                 /* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */
  197.     kHasCustomIcon                = 0x0400,                        /* Files and folders */
  198.     kIsStationery                = 0x0800,                        /* Files only */
  199.     kNameLocked                    = 0x1000,                        /* Files and folders */
  200.     kHasBundle                    = 0x2000,                        /* Files only */
  201.     kIsInvisible                = 0x4000,                        /* Files and folders */
  202.     kIsAlias                    = 0x8000                        /* Files only */
  203. };
  204.  
  205. /* Obsolete. Use names defined above. */
  206.  
  207. enum {
  208.     fOnDesk                        = kIsOnDesk,
  209.     fHasBundle                    = kHasBundle,
  210.     fInvisible                    = kIsInvisible
  211. };
  212.  
  213. /* Obsolete */
  214.  
  215. enum {
  216.     fTrash                        = -3,
  217.     fDesktop                    = -2,
  218.     fDisk                        = 0
  219. };
  220.  
  221. #if OLDROUTINENAMES
  222.  
  223. enum {
  224.     kIsStationary                = kIsStationery
  225. };
  226.  
  227. #endif  /* OLDROUTINENAMES */
  228.  
  229. /* Extended flags (extendedFinderFlags, fdXFlags and frXFlags) */
  230. /* Any flag not specified should be set to 0. */
  231.  
  232. enum {
  233.     kExtendedFlagsAreInvalid    = 0x8000,                        /* If set the other extended flags are ignored */
  234.     kExtendedFlagHasCustomBadge    = 0x0100,                        /* Set if the file or folder has a badge resource */
  235.     kExtendedFlagHasRoutingInfo    = 0x0004                        /* Set if the file contains routing info resource */
  236. };
  237.  
  238.  
  239.  
  240. /* Use this creation date to indicate that a file is temporarily busy */
  241. /* (while it is being downloaded or installed for example) */
  242. /* This will prevent the Finder from attempting to change attributes */
  243. /* of the file until it is fully created. */
  244.  
  245. enum {
  246.     kMagicBusyCreationDate        = 0x4F3AFDB0
  247. };
  248.  
  249.  
  250. /*------------------------------------------------------------------------*/
  251. /*
  252.    The following data structures are binary compatible with FInfo, DInfo,
  253.    FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
  254.    Use these data structures preferably to FInfo, etc...
  255. */
  256. /*------------------------------------------------------------------------*/
  257.  
  258.  
  259. struct FileInfo {
  260.     OSType                             fileType;                    /* The type of the file */
  261.     OSType                             fileCreator;                /* The file's creator */
  262.     UInt16                             finderFlags;                /* ex: kHasBundle, kIsInvisible... */
  263.     Point                             location;                    /* File's location in the folder */
  264.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  265.     UInt16                             reserved;                    /* (set to 0) */
  266. };
  267. typedef struct FileInfo                    FileInfo;
  268.  
  269. struct FolderInfo {
  270.     Rect                             windowBounds;                /* The position and dimension of the folder's window */
  271.     UInt16                             finderFlags;                /* ex. kIsInvisible, kNameLocked, etc.*/
  272.     Point                             location;                    /* Folder's location in the parent folder */
  273.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  274.     UInt16                             reserved;                    /* (set to 0) */
  275. };
  276. typedef struct FolderInfo                FolderInfo;
  277.  
  278. struct ExtendedFileInfo {
  279.     SInt16                             reserved[4];                /* Reserved (set to 0) */
  280.     UInt16                             extendedFinderFlags;        /* Extended flags (custom badge, routing info...) */
  281.     SInt16                             reserved2;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  282.     SInt32                             putAwayFolderID;            /* Put away folder ID */
  283. };
  284. typedef struct ExtendedFileInfo            ExtendedFileInfo;
  285.  
  286. struct ExtendedFolderInfo {
  287.     Point                             scrollPosition;                /* Scroll position (for icon views) */
  288.     SInt32                             reserved;                    /* Reserved (set to 0) */
  289.     UInt16                             extendedFinderFlags;        /* Extended flags (custom badge, routing info...) */
  290.     SInt16                             reserved2;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  291.     SInt32                             putAwayFolderID;            /* Put away folder ID */
  292. };
  293. typedef struct ExtendedFolderInfo        ExtendedFolderInfo;
  294. /*------------------------------------------------------------------------*/
  295. /*
  296.    The following data structures are here for compatibility.
  297.    Use the new data structures replacing them if possible (i.e. FileInfo 
  298.    instead of FInfo, etc...)
  299. */
  300. /*------------------------------------------------------------------------*/
  301. /* File info */
  302. /*
  303.      IMPORTANT:
  304.      In MacOS 8, the fdFldr field has become reserved for the Finder.
  305. */
  306.  
  307. struct FInfo {
  308.     OSType                             fdType;                        /* The type of the file */
  309.     OSType                             fdCreator;                    /* The file's creator */
  310.     UInt16                             fdFlags;                    /* Flags ex. kHasBundle, kIsInvisible, etc. */
  311.     Point                             fdLocation;                    /* File's location in folder. */
  312.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  313.     SInt16                             fdFldr;                        /* Reserved (set to 0) */
  314. };
  315. typedef struct FInfo                    FInfo;
  316. /* Extended file info */
  317. /*
  318.      IMPORTANT:
  319.      In MacOS 8, the fdIconID and fdComment fields were changed
  320.      to become reserved fields for the Finder.
  321.        The fdScript has become an extended flag.
  322. */
  323.  
  324. struct FXInfo {
  325.     SInt16                             fdIconID;                    /* Reserved (set to 0) */
  326.     SInt16                             fdReserved[3];                /* Reserved (set to 0) */
  327.     SInt8                             fdScript;                    /* Extended flags. Script code if high-bit is set */
  328.     SInt8                             fdXFlags;                    /* Extended flags */
  329.     SInt16                             fdComment;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  330.     SInt32                             fdPutAway;                    /* Put away folder ID */
  331. };
  332. typedef struct FXInfo                    FXInfo;
  333. /* Folder info */
  334. /*
  335.      IMPORTANT:
  336.      In MacOS 8, the frView field was changed to become reserved 
  337.        field for the Finder.
  338. */
  339.  
  340. struct DInfo {
  341.     Rect                             frRect;                        /* Folder's window bounds */
  342.     UInt16                             frFlags;                    /* Flags ex. kIsInvisible, kNameLocked, etc.*/
  343.     Point                             frLocation;                    /* Folder's location in parent folder */
  344.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  345.     SInt16                             frView;                        /* Reserved (set to 0) */
  346. };
  347. typedef struct DInfo                    DInfo;
  348. /* Extended folder info */
  349. /*
  350.      IMPORTANT:
  351.      In MacOS 8, the frOpenChain and frComment fields were changed
  352.      to become reserved fields for the Finder.
  353.        The frScript has become an extended flag.
  354. */
  355.  
  356. struct DXInfo {
  357.     Point                             frScroll;                    /* Scroll position */
  358.     SInt32                             frOpenChain;                /* Reserved (set to 0) */
  359.     SInt8                             frScript;                    /* Extended flags. Script code if high-bit is set */
  360.     SInt8                             frXFlags;                    /* Extended flags */
  361.     SInt16                             frComment;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  362.     SInt32                             frPutAway;                    /* Put away folder ID */
  363. };
  364. typedef struct DXInfo                    DXInfo;
  365. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  366.  
  367. enum {
  368.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  369.     hitDev                        = 1,                            /*Hit on one of my items*/
  370.     closeDev                    = 2,                            /*Close yourself*/
  371.     nulDev                        = 3,                            /*Null event*/
  372.     updateDev                    = 4,                            /*Update event*/
  373.     activDev                    = 5,                            /*Activate event*/
  374.     deactivDev                    = 6,                            /*Deactivate event*/
  375.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  376.     macDev                        = 8,                            /*Decide whether or not to show up*/
  377.     undoDev                        = 9,
  378.     cutDev                        = 10,
  379.     copyDev                        = 11,
  380.     pasteDev                    = 12,
  381.     clearDev                    = 13,
  382.     cursorDev                    = 14
  383. };
  384.  
  385.  
  386. /* Special values a Control Panel 'cdev' can return */
  387.  
  388. enum {
  389.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  390.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  391.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  392.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  393. };
  394.  
  395. /* Control Panel Default Proc */
  396. typedef CALLBACK_API( long , ControlPanelDefProcPtr )(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  397. typedef STACK_UPP_TYPE(ControlPanelDefProcPtr)                     ControlPanelDefUPP;
  398. enum { uppControlPanelDefProcInfo = 0x000FEAB0 };                 /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  399. #define NewControlPanelDefProc(userRoutine)                     (ControlPanelDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  400. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  401.  
  402.  
  403.  
  404. #if PRAGMA_STRUCT_ALIGN
  405.     #pragma options align=reset
  406. #elif PRAGMA_STRUCT_PACKPUSH
  407.     #pragma pack(pop)
  408. #elif PRAGMA_STRUCT_PACK
  409.     #pragma pack()
  410. #endif
  411.  
  412. #ifdef PRAGMA_IMPORT_OFF
  413. #pragma import off
  414. #elif PRAGMA_IMPORT
  415. #pragma import reset
  416. #endif
  417.  
  418. #ifdef __cplusplus
  419. }
  420. #endif
  421.  
  422. #endif /* __FINDER__ */
  423.  
  424.